# -*- coding: utf-8 -*-
# @Time    : 2019/2/25 9:13
# @Author  : yueconger
# @File    : find_kw_def.py
import re
import json


class FindKW(object):
    def find_kw(self):
        path = r'E:\bmsoft\ruanming\yuecong\FggSpider\刑事犯罪_2 - 副本.json'
        with open(path, 'r', encoding='utf-8') as f:
            contents = f.read()
        content_list = json.loads(contents)
        print(len(content_list))
        def_set = set()
        for content in content_list:
            answer = content['answer']
            res = re.findall('\\u3000', answer)
            if len(res) > 0:
                print(res)
                for r in res:
                    def_set.add(r)
        # for kw in def_set:
        #     with open('kw_def.txt', 'a+', encoding='utf-8') as f:
        #         f.write(kw + '\n')


if __name__ == '__main__':
    find_kw = FindKW()
    find_kw.find_kw()
